import { request } from '../../request';

// get list by page
export function fetchGetDictByPage(params: Api.Common.CommonSearchParams) {
  return request<Api.System.Dict.DictQueryRecord>({
    url: '/data/dict/listByPage',
    method: 'post',
    data: params
  });
}

// delete by id
export function fetchDeleteDictById(id: CommonType.IdType) {
  return request({
    url: '/data/dict/deleteById',
    method: 'post',
    params: {
      id
    }
  });
}

// delete batch by ids
export function fetchDeleteDictBatchByIds(ids: CommonType.IdType[]) {
  return request({
    url: '/data/dict/deleteBatchByIds',
    method: 'post',
    data: ids
  });
}

// save model
export function fetchDictSave(model: Api.System.Dict.DictFormModel) {
  return request({
    url: '/data/dict/save',
    method: 'post',
    data: model
  });
}

// get dict level text 获取 字典层级文本
export function fetchGetDictTextByIds(ids: CommonType.IdType[]) {
  return request<string>({
    url: '/data/dict/getDictTextByIds',
    method: 'post',
    data: ids
  });
}
